<?php

namespace apiend\modules\user\models;

use Yii;
use yii\data\ActiveDataProvider;

/**
 * 获取用户收件地址
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class AddressSearch extends \common\logics\address\FrontUserAddressLogic implements \common\db\SearchModelInterface {

    /**
     * 根据用户身份查询
     * @param array $params
     * @return ActiveDataProvider
     */
    public function buildQuery() {
        $query = static::find()->where([
            'user_id' => $this->user_id
        ])
        ->orderBy([
            'is_default' => SORT_DESC,
            'created_at' => SORT_ASC,
        ]);
        return $query;
    }

}
